import { defineStore } from "pinia";

export const useDemandStore = defineStore("demand", {
	state: () => {
		return {
			logisticsId: 0,
			logisticsOrgName: "",
			sellerList: [],
			labelData: <{ id ?: number, name ?: string, logo ?: string }>{},
			payUrl:"",
			current:-1,
			btype:1
		};
	},
	actions: {
		setLogisticsId(id : number, logisticsOrgName : string) {
			this.logisticsId = id || 0;
			this.logisticsOrgName = logisticsOrgName || "";
		},
		setLabel(data) {
			this.labelData = data || {};
		},
		setList(list) {
			this.sellerList = list || [];
		},
		setPayUrl(url:string){
			console.log("setPayUrl====",url);
			this.payUrl=url;
		},
		setCurrent(i:any){
			this.current=i;
		},
		setBtype(type:number){
			this.btype=type
		},
		clear() {
			this.logisticsId = 0;
			this.labelData = {};
			this.sellerList = [];
		}
	},
});